var fileNum = 0;
	var state = 0;
	function upload(){
		$("body").append("<div id='zzc'></div>");
		$("#tcctcs").show();
	}
	function uploadLogo() {

		$("#preview").remove();
		$("#photoshow").prepend("<img id=\"preview\"/>");
		$.ajaxFileUpload({
					url : '${ctx}/uploadFile/uploadImage?type=4',
					secureuri : false,
					fileElementId : 'logoimage',
					dataType : 'json',
					success : function(data, status) {
						var json = eval('(' + data + ')');
						if (json.state == 1) {
							$("#photo").append("<input id = \"logoimage\" title=\"点击可选择要上传的图片\" name = \"logoimage\"type = \"file\"  onchange=\"uploadLogo();\">");
							$.jBox.alert("只能上传.jpg, .png, .bmp的图片格式", "提示");
						}
						if (json.state == 2) {
							$("#photo").append("<input id = \"logoimage\" title=\"点击可选择要上传的图片\" name = \"logoimage\"type = \"file\"  onchange=\"uploadLogo();\">");
							$.jBox.alert("照片文件大小最大为10MB", "提示");
						}
						if (json.state == 3) {
							$("#photo").append("<input id = \"logoimage\" title=\"点击可选择要上传的图片\" name = \"logoimage\"type = \"file\"  onchange=\"uploadLogo();\">");
							$.jBox.alert("上传图片服务器失败", "提示");
							$.jBox.tip("上传图片服务器失败", 'error');
						}
						if (json.state == 0) {
							$(".zyaptit a").show();
							fileNum++;
							$("#photoshow").show();
							$("#photo").append("<input id = \"logoimage\" title=\"点击可选择要上传的图片\" name = \"logoimage\" type = \"file\"  onchange=\"uploadLogo();\">");
							$("<input id = \"address"+fileNum+"\"name = \"address"+fileNum+"\" type = \"hidden\">")
									.insertBefore($("#logoimage"));
							var photo = document.getElementById('photo');
							photo.className = 'zfileimgb';
							$('#preview').css("display", "none");
							$('#preview').attr("src", "${ctx}/fileUploadController/getImage?fileId='55e5203c728651d720eaf0b0'&picType=0");
							$('#preview').css("position", "absolute");
							var $img = $('#preview');
							var Dwidth = 0;//大图
							var Dheight = 0;

							$img.load(function() {
								var ysw = 214;
								var ysh = 140;
								Dwidth = $img.width();//大图
								Dheight = $img.height();
								if (Dwidth > ysw || Dheight > ysh) {
									var Blwidth = Dwidth / 214.0;
									var Blheight = Dheight / 140.0;

									if (Blwidth > Blheight) {
										$img.width(ysw);
										$img.height(ysw * Dheight / Dwidth);
										$img.css({
											"left" : 0,
											"top" : parseInt((ysh - $img
													.height()) / 2)
										});
									} else {
										$img.width(ysh * Dwidth / Dheight);
										$img.height(ysh);
										$img.css({
											"left" : parseInt((ysw - $img
													.width()) / 2),
											"top" : 0
										});
									}
									;
								} else {
									$img.css({
												"left" : parseInt((ysw - $img
														.width()) / 2),
												"top" : parseInt((ysh - $img
														.height()) / 2)
											});
								}
								$('#preview').css("display", "block");
							});
							$('#address' + fileNum).val(json.logoUrl);
						}
					},
					error : function(data, status, e) {
						alert(e);
					}
				});
	}